home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20020314-20021006
/
000016_fdc@columbia.edu_Thu Apr 4 09:51:06 EST 2002.msg
< prev
next >
Wrap
Text File
|
2002-10-06
|
3KB
|
89 lines
Article: 13286 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
From: fdc@columbia.edu (Frank da Cruz)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: kermit scripts, full-duplex
Date: 4 Apr 2002 09:50:47 -0500
Organization: Columbia University
Lines: 72
Message-ID: <a8hp87$mc8$1@watsol.cc.columbia.edu>
References: <a228ca9f.0204040327.edef2d6@posting.google.com>
NNTP-Posting-Host: watsol.cc.columbia.edu
X-Trace: newsmaster.cc.columbia.edu 1017931849 19503 128.59.39.139 (4 Apr 2002 14:50:49 GMT)
X-Complaints-To: postmaster@columbia.edu
NNTP-Posting-Date: 4 Apr 2002 14:50:49 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13286
In article <a228ca9f.0204040327.edef2d6@posting.google.com>,
ALB <casimir@roar.com> wrote:
:
: Is it possible to write a basic kermit script to perform full-duplex
: transfer ?
:
: The aim is to perform modem tests, without any protocols. Basically,
: send and receive the "check fox" string in loop, and verify
: automatically that no character are lost. The constraint is to be
: really full-duplex, and not sequentially send or receive.
:
Kermit scripts are single-process, single-thread. But that should not
be an impediment; the underlying operating system's device drivers
take care of full-duplex i/o (interrupt handling, buffering) for you.
: it would be something like that:
: wait_connection()
: while (true){
: how_many_bytes_can_I_send(&nb_bytes_tx)
: send_fox_string(nb_bytes_tx)
: get_number_of_bytes_received(&nb_bytes_rx)
: read_bytes(buff_p, nb_bytes_rx)
: check_fox_string(buff_p, nb_bytes)
: }
:
You'd set up the connection like this:
set port /dev/ttyS0 ; Or other device
if fail exit 1 Can't get port: \v(errstring)
set speed 57600 ; or other desired speed
set carrier-watch off ; you might need this
set flow rts/cts ; or other appropriate flow control
Then your echo checking loop could be like this (send a character,
read back its echo):
.string = "check fox" ; Define test string
.len := \flen(\m(string)) ; Its length
while true {
for \%i 1 \m(len) 1 {
output \s(string[\%i:1]) ; Send a character
if fail exit 1 Fatal i/o error on output: \v(errstring)
input 2 \s(string[\%i:1]) ; Wait 2 sec for echo
if fail {
echo [\s(string[\%i:1])] TIMED OUT: \v(inwait) sec
echo Restarting...
pause 1
clear input
break
} else {
echo [\s(string[\%i:1])] OK: \v(intime) msec
}
}
output \13 ; Send a carriage return
}
\s(blah[i:n]) means the substring of the string defined by the macro
whose name is "blah", starting at (1-based) position "i", length "n" bytes.
\v(intime) is the number of milliseconds it took for the echo to arrive.
\v(inwait) is the timeout interval on the INPUT command in seconds (it
needn't be hardwired -- you can use a variable).
Of course you could be more fancy -- send the whole string, read back the
echo a character at a time, etc, whatever you want.
More about Kermit script programming here:
http://www.columbia.edu/kermit/ckscripts.html
- Frank